package com.lq.ecoldchain.entity

import android.os.Parcel
import android.os.Parcelable

/*
*2018/12/26 0026  10:00
*function by lq
*/
data class UserInfoBean(
    val birthDate: Long?,
    val certificationPersonalStatus: Int?,
    val code: String,
    val gender: Int,
    val headImg: String,
    val id: String?,
    val inviteCode: String?,
    val inviter: String?,
    val isSettingPayPassword: Boolean,
    val loginPassword: String?,
    val nickName: String,
    val phone: String,
    val registerTime: String?,
    val score: Double?,
    val userName: String,
    val wechatUnionid: String?,
    val enterStatus:Int?
) : Parcelable {
    constructor(parcel: Parcel) : this(
            parcel.readValue(Long::class.java.classLoader) as? Long,
            parcel.readValue(Int::class.java.classLoader) as? Int,
            parcel.readString(),
            parcel.readInt(),
            parcel.readString(),
            parcel.readString(),
            parcel.readString(),
            parcel.readString(),
            parcel.readByte() != 0.toByte(),
            parcel.readString(),
            parcel.readString(),
            parcel.readString(),
            parcel.readString(),
            parcel.readValue(Double::class.java.classLoader) as? Double,
            parcel.readString(),
            parcel.readString(),
            parcel.readValue(Int::class.java.classLoader) as? Int) {
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeValue(birthDate)
        parcel.writeValue(certificationPersonalStatus)
        parcel.writeString(code)
        parcel.writeInt(gender)
        parcel.writeString(headImg)
        parcel.writeString(id)
        parcel.writeString(inviteCode)
        parcel.writeString(inviter)
        parcel.writeByte(if (isSettingPayPassword) 1 else 0)
        parcel.writeString(loginPassword)
        parcel.writeString(nickName)
        parcel.writeString(phone)
        parcel.writeString(registerTime)
        parcel.writeValue(score)
        parcel.writeString(userName)
        parcel.writeString(wechatUnionid)
        parcel.writeValue(enterStatus)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<UserInfoBean> {
        override fun createFromParcel(parcel: Parcel): UserInfoBean {
            return UserInfoBean(parcel)
        }

        override fun newArray(size: Int): Array<UserInfoBean?> {
            return arrayOfNulls(size)
        }
    }
}
